#include "matrix_led.h"
#include "c51.h"
#include "utils.h"

void matrix_led_74hc595_write(u8 byte) {
  for (u8 i = 0; i < 8; ++i) {
    SER = byte & (0x80 >> i);
    SRCLK = 1;
    SRCLK = 0;
  }
  RCLK = 1;
  RCLK = 0;
}

void matrix_led_show(u8 column, u8 flag) {
  matrix_led_74hc595_write(flag);
  P0 = ~(0x80 >> column);
  delay(1);
  P0 = 0xFF;
}
